#! /bin/sh

echo "Checking Assignment 3 (Part 1) Solutions" > part1-results.txt

echo "" >> part1-results.txt
echo "========== Checking xml files ==========" >> part1-results.txt

echo "" >> part1-results.txt
echo "----- property.xml -----" >> part1-results.txt
echo "Well-formed? (no news is good news)" >> part1-results.txt
xmllint --noout property.xml >> part1-results.txt  2>&1
echo "Valid? (no news is good news)" >> part1-results.txt
xmllint --noout --valid property.xml >> part1-results.txt  2>&1
echo "Pretty version:" >> part1-results.txt
xmllint --format property.xml >> part1-results.txt  2>&1

echo "" >> part1-results.txt
echo "----- owner.xml -----" >> part1-results.txt
echo "Well-formed? (no news is good news)" >> part1-results.txt
xmllint --noout owner.xml >> part1-results.txt  2>&1
echo "Valid? (no news is good news)" >> part1-results.txt
xmllint --noout --valid owner.xml >> part1-results.txt  2>&1
echo "Pretty version:" >> part1-results.txt
xmllint --format owner.xml >> part1-results.txt  2>&1

echo "" >> part1-results.txt
echo "----- renter.xml -----" >> part1-results.txt
echo "Well-formed? (no news is good news)" >> part1-results.txt
xmllint --noout renter.xml >> part1-results.txt  2>&1
echo "Valid? (no news is good news)" >> part1-results.txt
xmllint --noout --valid renter.xml >> part1-results.txt  2>&1
echo "Pretty version:" >> part1-results.txt
xmllint --format renter.xml >> part1-results.txt  2>&1

echo "" >> part1-results.txt
echo "------ Query ------" >> part1-results.txt
echo "" >> part1-results.txt
echo "Raw results:" >> part1-results.txt
galax-run part1.xq >> part1-results.txt 2>&1
